<template>
  <div>
    <header>
      <div class="left">
        <div class="left-left">
          <div>
            <figcaption>
              <img src="../assets/1.png" alt="" />
            </figcaption>
            <p>{{ res.nickName }}</p>
          </div>
        </div>
        <div class="left-right">
          <div class="right-left">
            <p>性别:</p>
            <p>省份:</p>
            <p>IP地址:</p>
            <p>注册时间:</p>
            <p>上次登录时间:</p>
          </div>
          <div class="right-right">
            <p>{{ sex }}</p>
            <p>{{ res.province }}</p>
            <p>---</p>
            <p>2020/12/10</p>
            <p>2020/12/9</p>
          </div>
        </div>
      </div>
      <div class="right">
        <div class="log">
          <span class="juan">劵</span>
          <p>
            <span>优惠券数量</span>
            <b>{{ res.coupon }}</b>
          </p>
        </div>
        <div class="log">
          <span class="juan">金</span>
          <p>
            <span>累计消费</span>
            <b>￥{{ res.allMoney }}</b>
          </p>
        </div>
        <div class="log">
          <span class="juan">登</span>
          <p>
            <span>登录次数</span>
            <b>{{ res.payCount }}</b>
          </p>
        </div>
      </div>
    </header>
    <div class="nav">
      <button @click="fanhiu()">
        <el-icon><Back /></el-icon> 返回
      </button>
    </div>
    <div class="bodye">
      <el-tabs v-model="activeName" class="demo-tabs">
        <el-tab-pane label="订单" name="first"
          ><UseradminVue></UseradminVue
        ></el-tab-pane>
        <el-tab-pane label="足迹" name="second"
          ><UserzhujiVue></UserzhujiVue
        ></el-tab-pane>
        <el-tab-pane label="收藏" name="third"
          ><UsershouchangVue></UsershouchangVue
        ></el-tab-pane>
        <el-tab-pane label="地址" name="fourth1"
          ><UserdizhiVue></UserdizhiVue
        ></el-tab-pane>
        <el-tab-pane label="优惠券" name="fourth2"
          ><UseryouhuiquanVue></UseryouhuiquanVue
        ></el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>

<script setup>
import { ref, onBeforeMount } from "vue";
import { useRouter, useRoute } from "vue-router";
import UserdizhiVue from "../Menuitem/User/Userdizhi.vue";
import UsershouchangVue from "../Menuitem/User/Usershouchang.vue";
import UseryouhuiquanVue from "../Menuitem/User/Useryouhuiquan.vue";
import UserzhujiVue from "../Menuitem/User/Userzhuji.vue";
import UseradminVue from "../Menuitem/User/Useradingdan.vue";
import { useUserStore } from "@/stores/userStore";

const activeName = ref("first");

const route = useRoute();

const router = useRouter();

const sex = ref("");

const res = ref([]);

console.log(res.value);

function fanhiu() {
  router.push("/user/UserList");
}

onBeforeMount(() => {
  res.value = JSON.parse(localStorage.getItem("thop"));
  if (res.value.sex == 0) {
    sex.value = "女";
    console.log(0);
  } else if (res.value.sex == 1) {
    sex.value = "男";
    console.log(1);
  } else {
    sex.value = "保密";
  }
  console.log(res.value);
});
</script>

<style scoped>
header {
  display: flex;
  justify-content: space-between;
}

.left {
  height: 200px;
  background-color: white;
  border-radius: 10px;
  width: 700px;
  margin-right: 16px;
  display: flex;
  justify-content: space-between;
  overflow: hidden;
}
.left-left {
  width: 60%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.left-left figcaption {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  overflow: hidden;
}
.left-left img {
  width: 70px;
}
.left-left img:hover {
  transform: scale(1.1);
  transition: all 0.5s;
}
.left-left p {
  text-align: center;
  margin-top: 6px;
}
.left-right {
  width: 100%;
  height: 170px;
  display: flex;
  justify-content: space-between;
}
.right-left {
  height: 100%;
  width: 50%;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}
.right-left p {
  text-align: right;
  margin-right: 8px;
  color: #666;
  font-size: 12px;
}
.right-right {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}
.right-right p {
  text-align: left;
  font-size: 12px;
}
.right {
  height: 200px;
  background-color: white;
  border-radius: 10px;
  width: 100%;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  padding-left: 50px;
}
.right .log {
  display: flex;
  width: 250px;
  overflow: hidden;
}
.right div .juan {
  display: inline-block;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: rgb(255, 107, 107);
  line-height: 56px;
  text-align: center;
  font-size: 24px;
  color: white;
  margin-right: 20px;
}
.right div .juan:hover {
  transform: scale(1.1);
  transition: all 0.5s;
}
.right div p {
  display: flex;
  flex-direction: column;
}
b {
  font-size: 30px;
  font-weight: 400;
}
.nav {
  width: 100%;
  box-sizing: border-box;
  padding-left: 30px;
  display: flex;
  justify-content: right;
}
.nav button {
  margin-top: 15px;
  background-color: #ffffff;
  width: 95px;
  height: 40px;
  border-radius: 20px;
  color: #606064;
  border: 1px solid #606064;
}
.bodye {
  margin-top: 16px;
  width: 100%;
  height: 57vh;
  border-radius: 10px;
  background-color: #ffffff;
  box-sizing: border-box;
  padding: 0 20px;
}
</style>
